<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" href="../../app/js/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="../../app/css/footer.css"/>
		<link rel="stylesheet" href="../../app/css/lystyle.css" /> 
		<link rel="stylesheet" href="../../app/css/backstage.css" />
		
		<style type="text/css">
			/*修改底部字体颜色*/
			.foot:nth-child(2){
				color: #e83023;
			}
			.ly-line {
				margin:5px 0.69444rem;
				height: 1px;
				background: #DEDEDE;
			}
			div.ly-info{
				margin: 0;
			}
			
		</style>
		<script src="../../app/js/flexible.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="wrap">
			<div id="main">
				<div id="header">
					<a  id="headImg" href="javascript:history.go(-1)"><img class="headImg" src="../../app/images/12.png"/></a>

					<a class="ly-headright" id="fo_app" data-toggle="modal" data-target="#myModal">冻结申请</a>	
					<p id="headTitle">提现</p>
				</div>
				
					<div class="row" style="padding-top: 1.4rem">
						<form action="" method="post">												
							<div class="col-xs-5 col-sm-5" style="margin: 5px;">
								<select id="chenggong" class="form-control ly_select">
									  <option>全部</option>
									  <option value="1">提现成功</option>
									  <option value="-1">提现失败</option>
									  <option value="0">提现中</option>
=								  </select>
							</div>	
							<style type="text/css">
								#time2{
									position: absolute;
									top: 0;
									height: 100%;
									opacity: 0;
								}
							</style>
							 <div class="col-xs-5 col-sm-5" style="margin: 5px;">
								<select id="time1" class="form-control ly_select">
									<option>全部</option>
								</select>
								<input id="time2" type="month" name="" id="" value="" />
									
							 </div>	
						</form>
					</div>	
					<!--内容-->
				<div id="content">
					<!--全部-->
					<div class="ly-info">
						<ul class="ly-info-ul">
							<li class="ly-info-li padding-tb">
								<p class="ly-font16">提现金额：<span>345.44</span><span class="ly-success">提现成功</span></p>
								<p class="ly-font14">2017.04.04 10:34</p>
							</li>
							<li class="ly-info-li padding-tb">
								<p class="ly-font16">提现金额：<span>345.44</span><span class="ly-error">提现失败</span></p>
								<p class="ly-font14">2017.04.04 10:34</p>
							</li>
							<li class="ly-info-li padding-tb">
								<p class="ly-font16">提现金额：<span>345.44</span><span class="ly-continue">提现中</span></p>
								<p class="ly-font14">2017.04.04 10:34</p>
							</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<!-- 按钮触发模态框 -->
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h5 style="text-align: center;color:#e83023;" class="modal-title" id="myModalLabel">冻结理由</h5>
            </div>
            <div class="modal-body">
            	<textarea id="liyou" rows="7" style="background: #F8F8F8;width: 100%;border-color: #EDEDED;" placeholder="请输入冻结理由"></textarea>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button type="button" class="btn btn-danger" data-dismiss="modal">取消</button>
                <button type="button" id="dongjie" class="btn btn-danger">确定</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

	</body>
	<script src="../../app/js/jquery-2.2.3.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript" src="../../app/js/bootstrap-3.3.7-dist/js/bootstrap.js" ></script>
	<script src="../../app/js/handlebars-v2.0.0.js" type="text/javascript" charset="utf-8"></script>
	<script id="table_template1" type="text/x-handlebars-template">
	  	{{#each list}}
	  		<li class="ly-info-li padding-tb">
				<p class="ly-font16">提现金额：<span>{{cashNum}}</span><span class="ly-success">提现成功</span></p>
				<p class="ly-font14">{{cashDate}}</p>
			</li>
		{{/each}}
	</script>
	<script id="table_template2" type="text/x-handlebars-template">
	  	{{#each list}}
	  		{{#compare cashStatus "1"}}
	  		<li class="ly-info-li padding-tb">
				<p class="ly-font16">提现金额：<span>{{cashNum}}</span><span class="ly-success">提现成功</span></p>
				<p class="ly-font14">{{cashDate}}</p>
			</li>
	        {{/compare}}
	        {{#compare cashStatus "0"}}
	  		<li class="ly-info-li padding-tb">
				<p class="ly-font16">提现金额：<span>{{cashNum}}</span><span class="ly-continue">提现中</span></p>
				<p class="ly-font14">{{cashDate}}</p>
			</li>
	        {{/compare}}
	        {{#compare cashStatus "-1"}}
	  		<li class="ly-info-li padding-tb">
				<p class="ly-font16">提现金额：<span>{{cashNum}}</span><span class="ly-error">提现失败</span></p>
				<p class="ly-font14">{{cashDate}}</p>
			</li>
	        {{/compare}}
		{{/each}}
	</script>
	<script src="../../app/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
	//登录判断
		console.log($.cookie('tokenRh'));
		if(!$.cookie('tokenRh')) { //当参数不为空符合条件
			window.location.href = "../../app/view/login/login/login.html";
		}
		$(function(){
			//获取当前登陆会员
//			$.cookie('tokenRh');
			var userId = 8;
			var userName = haojinhui;
			var realName = null;
			var juese=f0;
			$.ajax({
				type:"get",
				url:"http://47.104.13.109/member-service/auth/current?token="+$.cookie('tokenRh'),
				async:true,
				success:function(data){
					console.log(data);
					realName=data.roleList[0].name;
					userName=data.loginName;
					userId=data.id;
					juese=data.roleList[0].id;
				}
			});
			Handlebars.registerHelper("compare",function(v1,v2,options){
	           if(v1==v2){
	             //满足添加继续执行
	             return options.fn(this);
	           }else{
	             //不满足条件执行{{else}}部分
	             return options.inverse(this);
	           }
	         });
			$.ajax({
				type:"get",
				url:"http://47.104.13.109/cash-service/selectbyuser",
				async:true,
				data:{
					"pageNum":"1",
					"pageSize":"4",
					"userId":userId
				},
				success:function(data){
					var myTemplate1 = Handlebars.compile($("#table_template1").html());
					$('.ly-info-ul').html(myTemplate1(data));
				}
				
			});
			//按成功与否分类
			$('#chenggong').on('change',function(){
				$.ajax({
					type:"get",
					url:"http://47.104.13.109/cash-service/selectbyuser",
					async:true,
					data:{
						"pageNum":"1",
						"pageSize":"4",
						"userId":userId,
						"cashStatus":$('#chenggong').val()
					},
					success:function(data){
						var myTemplate2 = Handlebars.compile($("#table_template2").html());
						$('.ly-info-ul').html(myTemplate2(data));
					}
					
				});
			})
			//按时间分类
			$('#time2').on('change',function(){
//				alert($('#time2').val());
				var year=$('#time2').val().split('-')[0];
				var month=$('#time2').val().split('-')[1];
				$('#time1').html("<option>"+year+"年"+month+"月"+"</option>");
				var endtime;
				var starTime=$('#time2').val()+"-01 00:00:00";
				if(parseInt(month)>=12){
					year=parseInt(year+1);
					month=1;
					endtime=year+"-0"+month+"-01 00:00:00";
				}else{
					month=parseInt(month)+1;
					if(month<10){
						endtime=year+"-0"+month+"-01 00:00:00";
					}else{
						endtime=year+"-"+month+"-01 00:00:00";
					}
				}
				$.ajax({
					type:"get",
					url:"http://47.104.13.109/cash-service/selectbyuser",
					async:true,
					data:{
						"pageNum":"1",
						"pageSize":"4",
						"userId":userId,
						"cashStatus":$('#chenggong').val(),
						"cashDate":starTime,
						"cashDatetwo":endtime
					},
					success:function(data){
						var myTemplate3 = Handlebars.compile($("#table_template2").html());
						$('.ly-info-ul').html(myTemplate3(data));
					}
					
				});
				
			})
			//冻结申请
			$('#dongjie').on('click',function(){
				$.ajax({
					type:"post",
					url:"http://47.104.13.109/applyfor-service/freeze/applyfor",
					async:true,
					data:{
						"applyforUser":$.cookie('tokenRh'),
						"userName":userName,
						"userRole":juese,
						"buapSpare1":$('#liyou').val()
					},
					success:function(data){
						alert(data.message);
					}
				});
			})
		})
	</script>
</html>